<?php
// your connection
mysql_connect('localhost','espolon','espolon');
mysql_select_db('espolon');

// convert code
$res = mysql_query("SHOW TABLES");
while ($row = mysql_fetch_array($res)) {
  foreach ($row as $table) {
     mysql_query("ALTER TABLE " . $table . " CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci");
     echo "$table -> CONVERTED\n";
  }
}

?>